#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'kang'

#定义字典 使用{}

scores = {'tom':90, 'jack':80, 'aluc':70}
print(scores)

#获取
print(scores["tom"])
print(scores.get('tom'))

#添加
scores['lucy'] = 50
scores['tom'] = 10
print(scores)

#删除
scores.pop('lucy')
print(scores)

#判断是否存在指定key
print('lucy' in scores)

#遍历
print(scores.keys())
print(scores.values())
print(scores.items())

for k in scores.keys():
    print(k, scores[k])

for v in scores.values():
    print(v)

print('-' * 80)
for k, v in scores.items():
    print(k, v)



#set集合 无序 不可以重复
#定义set 使用{}
print('-' * 80)

a = {2, 3, 4, 6, 9,}
print(a, type(a))

num = set(a)
print(num, type(num))

num.add(98)
num.add(100)
print(num)
